package com.qqt.csr.im.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author: yang hao
 * @Date: 2024/10/14 11:00
 * @Description: 已读枚举，顺序不要随意变动
 **/
@Getter
public enum ReadFlagEnum {

    UNREAD(0, "未读"),

    READ(1, "已读")

    ;

    private final Integer code;

    private final String desc;

    ReadFlagEnum(final Integer code, final String desc){
        this.code = code;
        this.desc = desc;
    }

    public static final ReadFlagEnum[] ENUMS = ReadFlagEnum.values();

    public static ReadFlagEnum matchEnum(Integer value) {
        return Arrays.stream(values()).filter(ele -> Objects.equals(ele.code, value)).findFirst().orElse(null);
    }

}
